﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
namespace DoAnOOP.DataAccessLayer
{
    class clsThongTin_SinhVien
    {
        public DataRow GetThongTinSV()
        {
            string sql = "SELECT * FROM TAIKHOANSINHVIEN WHERE MSSV = '" + frmMain.mssv + "'";
            SqlDataAdapter da = new SqlDataAdapter(sql, clsConnect.ConnectionString);
            DataSet ds = new DataSet();
            da.Fill(ds);
            if (ds.Tables[0].Rows.Count != 0)
            {
                DataRow dr_ThongTin = ds.Tables[0].Rows[0];
                return dr_ThongTin;
            }
            else
            {
                return null;
            }
        }
        public bool UpdateMatKhau(string _matkhau)
        {
            string sql = "UPDATE TAIKHOANSINHVIEN SET MATKHAU = '" + _matkhau + "' WHERE MSSV = '" + frmMain.mssv + "'";
            SqlCommand command = new SqlCommand(sql, clsConnect.GetSqlConnect());
            try
            {
                command.ExecuteNonQuery();
                return true;
            }
            catch (System.Exception)
            {
                throw;
            }
        }
    }
}
